﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Cl.Utils.Helper
{
    public static class ConvertHelper
    {
        /// <summary>
        /// 根据timespan类型转换为“00:00:00”的格式
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        public static string ConvertToStringByTimeSpan(TimeSpan? value)
        {
            var result = string.Empty;
            if (value != null)
            {
                //var sa = value.Value.ToString(@"d\d hh\:mm\:ss");
                // 使用ToString格式化TimeSpan为HH:mm:ss格式
                result = value.Value.Days + "d." + value.Value.ToString(@"hh\:mm\:ss");
            }
            return result;
        }

    }
}
